package com.picvik.model;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.picvik.util.MyLog;

public class DeleteMediaModel {
	private Connection connection = null;
    private PreparedStatement ptmt = null;
    private ResultSet resultSet = null;

	public void deleteMedia(String tblname, String clause ,Integer mediaid) {
		try {	
    		//query string 
    		String qstring = "DELETE FROM " + tblname + " WHERE " + clause + " = " + mediaid + ";";
    		connection = com.picvik.util.MySqlConnection.getInstance().getConnection();
            ptmt = connection.prepareStatement(qstring);
            System.out.println(qstring);
            //ptmt.setString(1, username);
            //ptmt.setString(2, email);
            //ptmt.setString(3, password);
            ptmt.executeUpdate(qstring);
            //System.out.println(username);
            //System.out.println(qstring);
            ptmt.close();
            connection.close();
		
    	} catch (Exception e) {
		e.printStackTrace();
    	}// end catch
		
		
	}
}
